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