UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fdOfHooLsqyJsc0W4H3CeZSx8frC5y58OdR3IY0Cg+g='
WHERE
key_id = '6ae6af333838eb946e65c55146573b132eb240c970c11b7efeb234c86236f75e'
AND (
token = 'fdOfHooLsqyJsc0W4H3CeZSx8frC5y58OdR3IY0Cg+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)