UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l2nofGaVDeeDAFHMx8n7bOtopasFkLF4UnJWIN3JcME='
WHERE
key_id = '332e10d2662af8fa28773cb15a86fba64c88b36329e523c79b17ff11554f0789'
AND (
token = 'l2nofGaVDeeDAFHMx8n7bOtopasFkLF4UnJWIN3JcME='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)