UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dPtom3sBDobJWBTBJRc/mCTTMbeSLJulW0UOobm/39s=' 
WHERE 
  key_id = 'a8fc1cded147672c57f28480b3d780c6b5b03f225961b76b4ee3ed9358b3876b' 
  AND (
    token = 'dPtom3sBDobJWBTBJRc/mCTTMbeSLJulW0UOobm/39s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027