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