UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9jH2F44nWUjFctWpkbIKUrXGVMrpkKqM6mhwE6aHIUw='
WHERE
key_id = '5a831075e0f1e81ad2d983e7d8e521e0b49ba698a6326a1595d763d271270afd'
AND (
token = '9jH2F44nWUjFctWpkbIKUrXGVMrpkKqM6mhwE6aHIUw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)