UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C2OIRFHHrLCVHa3cjlBV8OU0ChNJr26AuplPAHZWtiM='
WHERE
key_id = '037c9ef054b098417c8162424f7eb7d22d1d672864e2030508b0d1e5cfed76c1'
AND (
token = 'C2OIRFHHrLCVHa3cjlBV8OU0ChNJr26AuplPAHZWtiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)