UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WZoZDn9vZasUyszkidzw3T9r3x03sJ+heYvWX2XK9Ws=' 
WHERE 
  key_id = '87dd6493606d1d30bdd8dc6b061de3e3ae17f554214c60f5b146fcebac17d0a2' 
  AND (
    token = 'WZoZDn9vZasUyszkidzw3T9r3x03sJ+heYvWX2XK9Ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028