UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h39/eqASXiSSkL73fr8GkPt8AlPjKYX5jARH3BRe3lE=' 
WHERE 
  key_id = '21ac02bb6827a29a728d17f88a96e5e4733297931ff68434024e8b2f76714a7a' 
  AND (
    token = 'h39/eqASXiSSkL73fr8GkPt8AlPjKYX5jARH3BRe3lE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049