UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ldwd/EweXk0VCQlepEAK7QDDvREk+zzgGg3qveKt6ak='
WHERE
key_id = 'c1a028b6ed367a027271201456f99b7e4a7b67816c2b9801b80a4092f22089a1'
AND (
token = 'ldwd/EweXk0VCQlepEAK7QDDvREk+zzgGg3qveKt6ak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)