UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P/462E8D9Wddret0e9gse5vq7acHa3oSUDmlSaMuNjs=' 
WHERE 
  key_id = 'b999b27f95fad26a69be7623d5a94116649e352252c451d706672ccafec0fd63' 
  AND (
    token = 'P/462E8D9Wddret0e9gse5vq7acHa3oSUDmlSaMuNjs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035