UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H85TuXHxojCZyIVLWKKCQi4QsyT2WvvBkmlV2Pi/brc=' 
WHERE 
  key_id = '2840eca3ca1c88e97d8b2687270b36d30f137e11de0743a9f8a80bc908762924' 
  AND (
    token = 'H85TuXHxojCZyIVLWKKCQi4QsyT2WvvBkmlV2Pi/brc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028