UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HXSJ+HvvX6GwutJrOgnxZ1b/m9Uzr4VWf+rJbbdmYGU='
WHERE
key_id = '4f88386c70b0802073a8b914a635580f5a9a6380c4765d76a4a46d0a8e289fac'
AND (
token = 'HXSJ+HvvX6GwutJrOgnxZ1b/m9Uzr4VWf+rJbbdmYGU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)