UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r3Y8FqOF4OHXrHvkQaUt7G5LlEZqwhOQsMshNMouKRs='
WHERE
key_id = '2709c7534bf1e6b0f0909177e482a77d1511551a6082c02f26872449d8cf8847'
AND (
token = 'r3Y8FqOF4OHXrHvkQaUt7G5LlEZqwhOQsMshNMouKRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)