UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xUIE+47yUyE9HwTG/jlSrD6qvAPtPIuGQlNrY8ieVcI='
WHERE
key_id = '0ed6619eac8ef9bf4e911283f20fd409634edcfe0db6e1b185df6db4286699ad'
AND (
token = 'xUIE+47yUyE9HwTG/jlSrD6qvAPtPIuGQlNrY8ieVcI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)