UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jVIplsL565ks3BWqoE1BkYwAsqmpchVzGrKMx4wMJn8='
WHERE
key_id = 'dacfbed69e50584ae6f7b0ffa75859336be063359a9c87eb2e38ccbf6d1b4a4c'
AND (
token = 'jVIplsL565ks3BWqoE1BkYwAsqmpchVzGrKMx4wMJn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)