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