UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RBrgDncbkOP2tak0reDhhicMqpGzJG/GKV3Js4ruH+w='
WHERE
key_id = '14ae49248e7f7d5a9e5545318b9fd4550ee8de533025e9292f649c1c061b5027'
AND (
token = 'RBrgDncbkOP2tak0reDhhicMqpGzJG/GKV3Js4ruH+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)