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