UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+NJIJwG2i+j+XKrKlkWEwka6KfMUMcgiLnvYssnu8d4='
WHERE
key_id = 'd388c26f434b350f9787cfffa009e06f42db1c6d026ef47c6d8567d631811f3a'
AND (
token = '+NJIJwG2i+j+XKrKlkWEwka6KfMUMcgiLnvYssnu8d4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)