UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'frUbWnNJ0jDkqETQLiKT7Drdw3c+ShnKuFczWnNyNKk='
WHERE
key_id = '9e520eeaeb648075679f4ced302807790276776cdb948b30db3b774b71c441b0'
AND (
token = 'frUbWnNJ0jDkqETQLiKT7Drdw3c+ShnKuFczWnNyNKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)