UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xEamdgZ3WGcaW5ADcRI2Vmie97m/oqW7+jgkNKV4oZY='
WHERE
key_id = 'bbbe7bcb4add6ca4120e7816be3b8ab710b76e84b6afc8aa289a5ed82649aec6'
AND (
token = 'xEamdgZ3WGcaW5ADcRI2Vmie97m/oqW7+jgkNKV4oZY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)