UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UYedG7AwVdFvBIEwPUvWO9syRJjaaPoUswlx3qIstc4='
WHERE
key_id = '3f0685d625eb190d090a27ad8c18596da37f9ab134d3c758ec86071da2bc9be8'
AND (
token = 'UYedG7AwVdFvBIEwPUvWO9syRJjaaPoUswlx3qIstc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)