UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sZg4MvekIx5PaUfFh5RCV9FaafV+fMQlm469dVSnejM='
WHERE
key_id = '818bbf3c1399c858976b68737f2ad4ecad6283e890090cc622584db4cd8ea02e'
AND (
token = 'sZg4MvekIx5PaUfFh5RCV9FaafV+fMQlm469dVSnejM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)