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