UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Asp43OnlqYF70lu4GXxP9kexNJP87yePjeZV0pkrjF0='
WHERE
key_id = '46da4ce72040d14e6a12885220bd2c198f1ad5a5c50123ae42ba20b20a760602'
AND (
token = 'Asp43OnlqYF70lu4GXxP9kexNJP87yePjeZV0pkrjF0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)