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