UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AgUDLgdxhrWB/1ji9GPAU7QEfCe0x5pACRrB0n5YwDE='
WHERE
key_id = '0c0973fd31dea77164af6437450ccc06b0ccfd1991e774dbc5c746a3f8ce61d4'
AND (
token = 'AgUDLgdxhrWB/1ji9GPAU7QEfCe0x5pACRrB0n5YwDE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)