UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'URIq1QxUqreTOqjnoRvFYCybdFG4ajHXIKwuLgNyj/s='
WHERE
key_id = 'c6e9404f719ab342e55f24e046ebf44d5c09109a08854d9bf7ca5592d67985dc'
AND (
token = 'URIq1QxUqreTOqjnoRvFYCybdFG4ajHXIKwuLgNyj/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)