UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A6XTwgQCiOuVqfz7hfCk/Yat4sHG464S1jmTc0u2PlU='
WHERE
key_id = '50976ff8b0d4aed749f80930691d9111b6e2e4277997e157a1be98fd6e661ac8'
AND (
token = 'A6XTwgQCiOuVqfz7hfCk/Yat4sHG464S1jmTc0u2PlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)