UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CD47TFezhEdciNE3C7n8O+QiuSMlA3AB67PMy9kQTOI='
WHERE
key_id = 'b995393af83be99e07110d36dd9a9442b233babf8f9100fe89346913f9688ed3'
AND (
token = 'CD47TFezhEdciNE3C7n8O+QiuSMlA3AB67PMy9kQTOI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)