UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xC65ET0lTIhJimS3S37etZIeYYmefoHjcQz1kBSsUMM='
WHERE
key_id = 'dc465a1ec186a69926045d92545036cf21cf0e6d13f7b1634f906ef74936d691'
AND (
token = 'xC65ET0lTIhJimS3S37etZIeYYmefoHjcQz1kBSsUMM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)