UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RNf1t8kdQNTtfT+G6xep4pMyowGLmaImIQFBEHd8yeY=' 
WHERE 
  key_id = 'cea71580c9def401b1cc838d373c2aa683f826ac3610c37e7447227dfa7c0cd2' 
  AND (
    token = 'RNf1t8kdQNTtfT+G6xep4pMyowGLmaImIQFBEHd8yeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041