UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8h0yT9RNP96x6kNKDNNBD/cULlacInLa09LAibRfTV8=' 
WHERE 
  key_id = '6771ac4226b7ae529d2c0a5688a825bfe5000334436837b3b46a9393fc1b6a30' 
  AND (
    token = '8h0yT9RNP96x6kNKDNNBD/cULlacInLa09LAibRfTV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025