UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r/p18qn44ATMnbLpjqjCdp0CNsUdE5k0yHN0rPkwwow='
WHERE
key_id = '0c4653978b0b8a6c46cec7fe931420942f18f90b279d374772d1caf455193ad6'
AND (
token = 'r/p18qn44ATMnbLpjqjCdp0CNsUdE5k0yHN0rPkwwow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)